<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>充值</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/jiazai.css">
    <style>
        .tit-wrap {
            position: fixed;
            top: 10px;
            right: 0;
            left: 0;
            padding: 0 20px;
            font-size: 16px;
            color: white;
        }
        
        .content {
            position: fixed;
            top: 50px;
            right: 0;
            left: 0;
            bottom: 0;
            padding: 0 20px;
            overflow: auto;
        }
        
        .logo {
            padding: 20px 0 40px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        
        .logo>span {
            padding-top: 10px;
            font-size: 18px;
            color: #9197AE;
        }
        
        .address {
            padding: 18px 15px;
            background: #353742;
            opacity: .8;
            white-space: nowrap;
            overflow: auto;
        }
        
        .address>span {
            width: 100%;
            font-size: 14px;
            color: #9197AE;
            text-align: center;
            background: transparent;
        }
        
        .qr {
            padding-top: 30px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .btn-copy {
            padding-top: 50px;
            display: flex;
            justify-content: center;
        }
        
        .btn-copy>p {
            padding: 15px 30px;
            font-size: 14px;
            color: white;
            background: #2590fe;
            border-radius: 5px;
        }
    </style>
</head>

<body style="background:#2a2c35;">
    <div id='app'>


        <!-- 加载中动画 -->
        <div id='jiazai-ani' v-if='jiazai'>
            <div class="arc"></div>
            <h1><span>LOADING</span></h1>
        </div>
        <!-- 加载中动画 -->

        <div class='tit-wrap dis-spa'>
            <img @click='_close()' src="./img/left.svg" width="22px">
            <div>
                <span>充值</span>
            </div>
            <span style="opacity:0;">1</span>
        </div>

        <div class='content'>
            <div class='logo'>
                <img src="./img/logo.png" width="80px" height="80px">
                <span v-text='phone()'>188845454</span>
            </div>
            <div class='address'>
                <span v-text='address'>1315454545</span>
            </div>
            <div class='qr'>
                <img src="./img/qr.png" width="140px" height="140px">
            </div>
            <div class='btn-copy'>
                <p @click="_copy(address);_toast('复制成功');">复制链接地址</p>
            </div>
        </div>
    </div>
    <script src="js/comm.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.qrcode.min.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                jiazai: false,
                address: ''
            },
            mounted: function() {
                this.getData();
            },
            methods: {
                getData: function() {
                    var This = this;
                    var user = JSON.parse(localStorage.getItem('cc_user'));
                    This.jiazai = true;
                    _post(CHONZHI_INDEX, {
                        userid: user.userid,
                        session: user.session
                    }, function(data) {
                        if (data.status == 1) {
                            This.address = data.back;
                            setTimeout(function() {
                                This.maskQr(data.back);
                            }, 600);
                        } else {
                            This.jiazai = false;
                            _toast('地址生成出错');
                            setTimeout(function() {
                                _close();
                            }, 1000);
                        }
                    });
                },
                //处理手机号
                phone: function() {
                    var phone = JSON.parse(localStorage.getItem('cc_user')).phone;
                    return phone.slice(0, 4) + '****' + phone.slice(8, 11);
                },
                //确认收入的点击
                maskQr: function(address) {
                    //生成二维码
                    $('.qr').html('');
                    jQuery('.qr').qrcode({
                        render: "canvas", //也可以替换为table
                        width: 150,
                        height: 150,
                        text: address
                    });
                    this.jiazai = false;
                },
            }
        });
    </script>
</body>

</html>